
if( SERVER ) then
   
 	AddCSLuaFile( "shared.lua" ) 
 	SWEP.HoldType = "pistol";
 
 end 

 
 SWEP.Base = "ts2_base";
   
 SWEP.Spawnable			= false 
 SWEP.AdminSpawnable		= false 
   
SWEP.ViewModel			= "models/weapons/v_riot_xm1014.mdl"
SWEP.WorldModel			= "models/weapons/w_boom_xm1014.mdl"
SWEP.Primary.Sound			= Sound( "Weapon_Shotgun.Single" )

SWEP.PrintName = "Riot Bean Shotgun";
SWEP.TS2Desc = "Do some serious damage.";


SWEP.ShotgunReload = true;

SWEP.Primary.Recoil			= .1
SWEP.Primary.RecoilAdd			= 0
SWEP.Primary.RecoilMin = .1
SWEP.Primary.RecoilMax = 3
 
SWEP.Primary.ViewPunchMul = 70;
SWEP.Primary.Damage			= 0
SWEP.Primary.NumShots		= 1 
 
SWEP.TS2HoldType = "RIFLE";

SWEP.Primary.DoorBreach = true;
SWEP.Primary.HighPowered = true;
SWEP.Primary.ClipSize = 6;
SWEP.Primary.DefaultClip = 6;
SWEP.Primary.Ammo = "smg1";
SWEP.Primary.Delay = 1;
SWEP.Primary.Automatic = false;
SWEP.Primary.SpreadCone = Vector( .04, .04, 0 );

SWEP.Primary.IronSightPos = Vector( -9.0, 4.0, -5.0 );
SWEP.Primary.IronSightAng = Vector( -.5, -1.0, 0.0 );

SWEP.Primary.HolsteredPos = Vector( 10.8, -5.0, -2.0 );
SWEP.Primary.HolsteredAng = Vector( -5.0, 50.0, 0.0 );

SWEP.ItemWidth = 3;
SWEP.ItemHeight = 1;


SWEP.IconCamPos = Vector( 8, 58, 50 ) 
SWEP.IconLookAt = Vector( 1, 0, 0 ) 
SWEP.IconFOV = 12

SWEP.Price = 850
   
   
function SWEP:PrimaryAttack()
   

	local bullet = {} 
	bullet.Num 		= 1;
	bullet.Src 		= self.Owner:GetShootPos()		
	bullet.Dir 		= self.Owner:GetAimVector()		
	bullet.Spread 	= Vector( .1, .1, 0 )
	bullet.Tracer	= 0								
	bullet.Force	= 75								
	bullet.Damage	= 0;
	 	 
	self.Owner:FireBullets( bullet ) 
		

	local trace = { }
	trace.start = self.Owner:EyePos();
	trace.endpos = trace.start + self.Owner:GetAimVector() * 4096;
	trace.filter = self.Owner;
	
	local tr = util.TraceLine( trace );
		
	if( tr.Hit ) then
		self.Weapon:EmitSound( Sound( "Weapon_Shotgun.Single" ) );
	else
		self.Weapon:EmitSound( Sound( "Weapon_Shotgun.Single" ) );
	end
		
	if( SERVER ) then
		
		local power = 0.5;
		local norm = ( self.Owner:EyePos() - tr.HitPos ):Normalize();
		
		if( tr.Entity:IsValid() ) then
			if( tr.Entity:IsPlayer() ) then
				tr.Entity:SetPlayerConsciousness( 0 );
			end
		
		end
		
	end

end

